import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: Login,
    meta:{
      title:'登录',
      isLogin: false,
    }
  },
  {
    path: '/active',
    name: 'active',
    component: Login,
    meta:{
      title:'用户激活',
      isLogin: true,
    },
    component: ()=>import('../views/ActiveView'),
  },
  {
    path: '/home',
    // name: 'home',
    redirect: '/blog/message',
    meta:{
      title:'首页',
      isLogin: true,
    },
    component: ()=>import('../views/home/Home'),
    children:[
      
      {
        path: '/feeInfo',
        name: 'feeInfo',
        meta:{title:'费用信息'},
        component:()=>import('../views/home/feeInfo/FeeInfo'),
        children:[
          {
            path:'/feeInfo/paymentDetails',
            name: 'paymentDetails',
            meta:{
              title:'缴费明细',
              isLogin: true,
            },
            component: ()=>import('../views/home/feeInfo/PaymentDetails')
          },
         
          {
            path:'/feeInfo/myUnpaiedInfo',
            name: 'myUnpaiedInfo',
            meta:{
              title:'我的欠费',
              isLogin: true,
            },
            component: ()=>import('../views/home/feeInfo/MyUpaiedInfo')
          },
          {
            path:'/feeInfo/basisFee',
            name: 'basisFee',
            meta:{
              title:'计费标准',
              isLogin: true,
            },
            component: ()=>import('../views/home/feeInfo/BasisFee')
          },
    
        ]
      },

      {
        path:'/blog',
        name: 'blog',
        meta:{
          title:'社区论坛',
          isLogin: true,
        },
        component: ()=>import('../views/home/blog/Blog'),
        children: [
          {
            path:'/blog/message',
            name: 'message',
            meta:{
              title:'论坛广场',
              isLogin: true,
            },
            component: ()=>import('../views/home/blog/BlogMessage'),
          },
          {
            path:'/blog/messageDetails',
            name: 'messageDetails',
            meta:{
              title:'帖子详情',
              isLogin: true,
            },
            component: ()=>import('../views/home/blog/BlogDetails'),
          },
          {
            path:'/blog/personalCenter',
            name: 'personalCenter',
            meta:{
              title:'个人中心',
              isLogin: true,
            },
            component: ()=>import('../views/home/blog/PersonalCenter'),
          },
          {
            path:'/blog/myMessage',
            name: 'myMessage',
            meta:{
              title:'我的帖子',
              isLogin: true,
            },
            component: ()=>import('../views/home/blog/MyMessage'),
          },
          {
            path:'/blog/myAttention',
            name: 'myAttention',
            meta:{
              title:'我的关注',
              isLogin: true,
            },
            component: ()=>import('../views/home/blog/MyAttention'),
          },
        ]
      }
    ]
  },

  
  
    
]

const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}


const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
